import request from '@/utils/request'

export function getEventList(params) {
  return request({
    url: '/medical/event/query/match', // '/medical/event/query/match',
    method: 'get',
    params
  })
}

export function EventAthleteOpen(params) {
  return request({
    url: '/open/event/query',
    method: 'get',
    params
  })
}

export function getEventInfo(params) {
  return request({
    url: '/medical/event/query/match_info',
    method: 'get',
    params
  })
}

export function addEvent(params) {
  return request({
    url: '/medical/event/match/handle', // 'save',
    method: 'post',
    data: params,
    transformRequest: [function(data) {
      const formData = new FormData()
      for (const key of Object.keys(data)) {
        formData.append(key, data[key])
      }
      return formData
    }]
  })
}

export function modifyEvent(params) {
  return request({
    url: '/medical/event/match/modify',
    method: 'post',
    data: params,
    transformRequest: [function(data) {
      const formData = new FormData()
      for (const key of Object.keys(data)) {
        formData.append(key, data[key])
      }
      return formData
    }]
  })
}

export function addEventScene(params) {
  return request({
    url: '/medical/event/scene/handle', // save',
    method: 'post',
    params
  })
}

export function modifyEventScene(params) {
  return request({
    url: '/medical/event/scene/modify',
    method: 'post',
    params
  })
}

export function delEventScene(params) {
  return request({
    url: '/medical/event/scene/del',
    method: 'post',
    params
  })
}
export function getEventScene(params) {
  return request({
    url: '/medical/event/query/scene',
    method: 'get',
    params
  })
}

export function addEventAthlete(params) {
  return request({
    url: '/medical/event/event_athlete/handle',
    method: 'post',
    params
  })
}

export function modifyEventAthlete(params) {
  return request({
    url: '/medical/event/event_athlete/modify',
    method: 'post',
    params
  })
}

export function delEventAthlete(params) {
  return request({
    url: '/medical/event/event_athlete/del',
    method: 'post',
    params
  })
}

export function getEventAthlete(params) {
  return request({
    url: '/medical/event/query/event_athlete',
    method: 'get',
    params
  })
}
